#include<iostream>
using namespace std;
const int N = 1e3 + 10;
int next[N];
int KMP(char arr[], char str[])
{
	int len1 = strlen(arr);
	int len2 = strlen(str);
	next[0] = -1;
	int i = -1;
	int j = 0;
	while (i < len1 && j < len2) {
		if (arr[i] == arr[j]) {
			i++;
			j++;
		}	
		else {
			j = arr[j];
		}
	}
	if (j == len2) {
		return i - j;
	}
	return 0;
}
